﻿@using Utry.Framework.Mvc
@model Utry.CI.Models.ProjectModel
﻿@{
    ViewBag.Title = "CI | 项目详情";
}

<div style="margin-top:39px;">

 <div class="tab-pane" >

           @Html.JPartial("_Notifications")

          <!--有用代码-->
    <div class="portlet" style=" border: 0px ;">   
                  <div class="portlet-body" style="padding:0px;">
                     <ul  class="nav nav-tabs">
                         <li >
                            <i class="icon-reorder"></i><span style="font-size:16px; font-weight:bold; padding-right:20px;">@Model.Project.ProjectName</span> 
                            <select id="ddlpro" class="select2_category form-control" style="width:200px;"> 
                                @foreach (var item in Model.ProjectList)
                                {
                                    <option value="@item.ID">@item.ProjectName</option>
                                }
                             </select>
                         </li>
                         <li class="" style="float:right"><a href="@Url.Action("ProjectVersionDownLoad", "Project", new { id = Model.Project.ID })" >版本下载</a></li>
                         <li class="" style="float:right"><a href="@Url.Action("ProjectReleaseInfo", "Project", new { id = Model.Project.ID })" >版本发布</a></li>
                         <li class="active" style="float:right"><a  href="@Url.Action("ProjectReviewInfo", "Project", new { id = Model.Project.ID })" data-toggle="tab">需求评审</a></li>
                        <li class="" style="float:right"><a  href="@Url.Action("ProjectInfo", "Project", new { id= Model.Project.ID })" >基本信息</a></li>
                     </ul>
<div  class="tab-content">
<form name="form1" method="post" action="@Url.Action("ProjectReviewinfo", "Project", new { id = Model.Project.ID })"  enctype="multipart/form-data">
   <div class="table-toolbar">
           @if (ViewBag.Role == "管理员")
           { 
               <div class="btn-group">
                  <a id="sample_editable_1_new" class="btn btn-sm btn-success"  href="@Url.Action("ReviewAdd", "Review")" >
                     添加评审 <i class="icon-plus"></i>
                  </a>
                </div>
           }
        

        <div class="btn-group">
           @Html.DropDownList("Status", Model.StatusSelectItem, new { @class = "select2 form-control" })
        </div>

      <div class="btn-group">
           	<input type="text" name="DemandCode" id="DemandCode" placeholder="需求编号" value="@Model.DemandCode" class="form-control" style="width:180px;"/>
      </div>

      <div class="btn-group">
            <input type="text" name="BeginDate" id="BeginDate" placeholder="开始时间"  value="@Model.BeginDate" class="form-control datefrom" style="width:130px;"/> 
      </div>

     <div class="btn-group">
			<input type="text" name="EndDate" id="EndDate" placeholder="结束时间" value="@Model.EndDate" class="form-control dateto" style="width:130px;"/>        
      </div>

      <div class="btn-group">
            <button type="button" class="btn btn-sm btn-success" onclick="query()"><i class="icon-search"></i></button>      </div>
   
                      
</div>
                            <table class="table table-striped table-bordered table-hover" id="projectlist">
                              <thead>
                                <tr>
                                  <th>评审时间</th>
                                  <th>需求编号</th>
                                  <th>评审结果</th>
                                  <th>耗时(h)</th>
                                  <th>问题个数</th>
                                  <th>操作</th>
                                </tr>
                              </thead>
                              <tbody>

                               @foreach (var item in Model.reviewlist)
                               {
                                <tr>
                                 <td>@item.BeginDate </td>
                                  @if (item.DemandCode == null)
                                  {
                                      <td></td>
                                  }
                                  else
                                  {
                                      <td>@Html.Raw(item.DemandCode.Replace(",", "<br/>"))</td>
                                  }
                                  <td>@item.Status</td>
                                  @{
                                 string time = item.EndDate.Subtract(item.BeginDate).TotalHours.ToString();
                                 string hour = string.Empty;
                                 var count = 0;
                                 
                                 
                                 if (time.Length == 1)
                                 {
                                     hour = time;
                                 }
                                 else
                                 {
                                     if (time.Length > 3) 
                                     {
                                         hour = time.Substring(0, 3);                                     
                                     }
                                 }

                                 if (item.Description != null)
                                 {
                                     var descriptions = item.Description.Split(',');
                                     foreach (var descpt in descriptions)
                                     {
                                         if (descpt.Length > 1)
                                         {
                                             count++;
                                         }
                                     }
                                 }
                                   } 
       
                                  <td>@hour</td>
                                  @if (item.Description == null)
                                  {
                                      <td></td>
                                  }
                                  else
                                  {
                                      <td>@count</td>
                                  }
                                  <td>
                                     <div class="btn-group">
                                        <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                          操作 <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu" role="menu">
                                          @if (ViewBag.Role != null && ViewBag.Role == "管理员")
                                          { 
                                              <li><a href="@Url.Action("ReviewEdit", "review", new { Id = item.ID, ifPro = 1 })">修改</a></li>
                                              <li><a href="@Url.Action("ReviewDelete", "review", new { Id = item.ID, DelID = item.ProjectID })" onclick="return confirm('确定删除?');">删除</a></li>
                                          }
                                             <li><a href="@Url.Action("ReviewEdit", "review", new { Id = item.ID, ifPro = 1, act = "view" })" target="_blank">查看</a></li>
                                        </ul>
                                      </div>
                                   </td>
                                </tr>
                               }

                              </tbody>
                            </table>

                            <div id="pager"><ul class="pagination">@Html.Pager(Model.PageList).ShowIndividualPages(true)</ul> </div>
                        </form>
                     </div>
                  </div>
               </div>
 </div>

</div>
<script type="text/javascript">
    jQuery(document).ready(function () {
        // initiate layout and plugins
        App.init();
        FormSamples.init();
    });
    $(document).ready(function () {
        $("#ddlpro").change(function () {
            var url = $("#ddlpro").val();
            var index = $("#ddlpro").get(0).selectedIndex;
            //alert(index);
            window.location.href = "/Project/ProjectReviewInfo?id=" + url;
        });
    });
    //查询
    function query() {
        document.forms[0].action = '@Url.Action("ProjectReviewinfo", "Project", new { id = Model.Project.ID })';
        document.forms[0].method = 'post';
        document.forms[0].submit();
    }

    $(".datefrom").datetimepicker({ format: 'yyyy-mm-dd hh:ii', autoclose: true });
    $(".dateto").datetimepicker({ format: 'yyyy-mm-dd hh:ii', autoclose: true });
</script>

